<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>使用datepicker插件实现分段时间的选择</title>
<script type="text/javascript" src="lib/jquery-2.1.1.js"></script>
<script type="text/javascript" src="lib/jquery-ui.min.js"></script>
<style type="text/css">
	body{font-size:13px}
	.txt{border:#666 1px solid;padding:2px;width:100px;margin-right:3px;}
</style>
<script type="text/javascript">
	$(function(){
		$("#txtStart").datepicker({changeMonth:true,changeYear:true,showWeek:true,firstDay:"1",
				onSelect:function(dateText,inst){
					$("#txtEnd").datepicker('option','minDate',new Date(dateText.replace('-',',')));
				}
			});

		$("#txtEnd").datepicker({changeMonth:true,changeYear:true,showWeek:true,firstDay:"1",
			onSelect:function(dateText,inst){
				$("#txtStart").datepicker('option','maxDate',new Date(dateText.replace('-',',')));
			}
		});
	})
</script>
</head>
<body>

	<div>
		开始日期：<input name="txtStart" id="txtStart" class="txt"/>
		结束日期：<input name="txtEnd" id="txtEnd" class="txt"/>
	</div>
	
</body>
</html>